package org.seedltd.upms.controller.detection;

import java.util.List;

import org.seedltd.core.base.BaseController;
import org.seedltd.log.annotation.SysLog;
import org.seedltd.upms.model.detection.form.DetectionGradingForm;
import org.seedltd.upms.model.detection.vo.DetectionGradingVO;
import org.seedltd.upms.service.detection.DetectionGradingService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import lombok.AllArgsConstructor;

/**
 *
 * 评分管理控制器
 * 
 * @author laizuan
 * @version 1.0
 * @since 2021/08/25
 */
@RestController
@AllArgsConstructor
@RequestMapping("/detectionGrading")
public class DetectionGradingController extends BaseController<DetectionGradingService> {
    /**
     * 修改
     * 
     * @param form
     *            评分管理表单数据
     * @return 修改状态。true标识修改成功，false标识修改失败
     */
    @SysLog("修改评分数据")
    @PostMapping(value = "/update")
    @PreAuthorize("hasAuthority('detection:grading:update')")
    public boolean update(@RequestBody @Validated DetectionGradingForm form) {
        return baseService.update(form);
    }

    /**
     * 列表
     *
     * @return 评分管理列表集合
     */
    @PostMapping(value = "/list")
    public List<DetectionGradingVO> page() {
        return baseService.listAll();
    }

}